/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package TableModels;

import Entities.BoothEmployee;
import java.util.ArrayList;
import javax.swing.table.AbstractTableModel;

/**
 *
 * @author Administrator
 */
public class BoothEmployeeTableModel extends AbstractTableModel{
    ArrayList<BoothEmployee> arrList=new ArrayList<BoothEmployee>();
    public BoothEmployeeTableModel(ArrayList<BoothEmployee> arr)
    {
       arrList=arr;
    }
    @Override
    public int getRowCount() {
        return arrList.size();
    }

    @Override
    public int getColumnCount() {
       return 8;
    }

    @Override
    public Object getValueAt(int rowIndex, int columnIndex) {
        BoothEmployee objEmp=arrList.get(rowIndex);
           Object value=null;
      switch(columnIndex)
      {
         case 0:
              value =objEmp.getId();
              break;
          case 1:
               value=objEmp.getName();
              break;
          case 2:
              value=objEmp.getPhone();
              break;
          case 3:
              value=objEmp.getEmail();
              break;
          case 4:
              value=objEmp.getAddress();
              break;
          case 5:
              value=objEmp.getIdentityCardNumber();
              break;
          case 6:
              value=objEmp.getBoothID();
              break;
          case 7:
              value=objEmp.getModifiedDate();
              break;
      }
      return value;
    }
        @Override
    public String getColumnName(int column) {
        String colName = "";
        switch(column){
            case 0:
                colName = "ID";
                break;
            case 1:
                colName = "Name";
                break;
            case 2:
                colName = "phone";
                break;
           case 3:
                colName = "email";
                break;
            case 4:
                colName = "address";
                break;
            case 5:
                colName = "IdentityCard";
                break;
            case 6:
                colName = "Booth ID";
                break;
            case 7:
                colName = "Modified Date";
                break;
        }
        return colName;
    }
    public BoothEmployee Getvalue(int index)
    {
      return arrList.get(index);
    }

}
